package com.zw.data.mybatis.controller;

import com.zw.data.mybatis.entity.Product;
import com.zw.data.mybatis.service.ProductService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author zhangwei
 */
@RestController
@Api(tags = "商品管理系统Api接口")
@RequestMapping("/product")
public class ProductController {
    @Resource
    private ProductService productService;

    @ApiOperation("通过商品名称查询商品信息")
    @ApiImplicitParams({@ApiImplicitParam(name = "page", value = "页码"),
            //
            @ApiImplicitParam(name = "size", value = "条数"),
            //
            @ApiImplicitParam(name = "keyword", value = "搜索关键字")})
    @GetMapping("/list")
    public List<Product> queryProduct(int page, int size, String keyword) {
        return productService.queryProduct(page, size, keyword);
    }
}
